package gptma.fo.rest;

import gptma.bo.model.project.Project;
import gptma.bo.services.project.ProjectServices;

import java.util.List;

import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * 
 * @author xcl
 */
@RequestScoped
@Path("projects")
public class ProjectResource {

	@EJB
	private ProjectServices projectServices;

	@GET
	@Produces(MediaType.APPLICATION_XML)
	public List<Project> findAll() {
		return projectServices.findAll();
	}

	@GET
	@Path("{projectId}")
	@Produces(MediaType.APPLICATION_XML)
	public Project findById(@PathParam("projectId") Long projectId) {
		return projectServices.findById(projectId);
	}

}
